<!DOCTYPE html>
<html><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>springboot抛弃tomcat</title>
<style type="text/css">
    body{
        background-color: #3C3F41;
    }
    a{
        text-decoration: none;
        color: #fbfbff;
    }
</style>
<body><head>
    <style type="text/css">
        nav ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            overflow: hidden;
            background-color: #333;
            position: -webkit-sticky;  
            position: sticky;
            top: 0;
        }

        nav li {
            float: left;
        }

        nav li a {
            display: block;
            color: white;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
        }

         
        nav li a:hover {
            background-color: #111;
        }
        .active {
            background-color: #4CAF50;
        }
    </style>
</head>

<nav>
    <ul>
        
        
        <li><a href="/blog/">home</a></li>
         
        
        <li><a href="/blog/post">博文</a></li>
         
        
        <li><a href="/blog/about">about</a></li>
         
    </ul>
</nav>
<div id="content" style="margin: auto;width: 50%;padding: 10px; color: #ffffff;height: 100%">
    <article>
        <header>
            <h1 class="post-title">springboot抛弃tomcat</h1>
        </header>
        <p><strong>直接修改启动类</strong></p>
<pre tabindex="0"><code>package com.smile.client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.concurrent.CountDownLatch;

@SpringBootApplication
public class ClientApplication {

	public static void main(String[] args) throws InterruptedException {
        SpringApplication application = new SpringApplication( ClientApplication.class );

        // 如果是web环境，默认创建AnnotationConfigEmbeddedWebApplicationContext，因此要指定applicationContextClass属性
        application.setApplicationContextClass( AnnotationConfigApplicationContext.class );
        application.run( args );

        // 如果不想让spring容器退出，可以使用以下代码
        CountDownLatch latch = new CountDownLatch( 1 );
        latch.await();
	}

}
</code></pre>
        <br />

        <div>
            
            <a href="https://alittlesmile.gitee.io/blog/post/windows/windows%E6%B8%85%E9%99%A4%E7%AB%AF%E5%8F%A3%E5%8D%A0%E7%94%A8/">&lt; windows 清除端口占用</a>
            

            
            <a href="https://alittlesmile.gitee.io/blog/post/computer/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84%E5%87%A0%E7%A7%8Dio%E6%8E%A7%E5%88%B6%E6%96%B9%E5%BC%8F/" style="float:right">springboot抛弃tomcat ></a>
            
        </div>
    </article>

</div></body>
</html>
